home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-12-08 | 41.8 KB | 1,119 lines | [TEXT/R*ch] |
- C.S.M.P. Digest Tue, 20 Oct 92 Volume 1 : Issue 190
-
- Today's Topics:
-
- Does THINK C have glue for FindFolder?
- How do I see if modifiers are down?
- Editor for mini icons?
- Prolog for Mac
- ATrap to Determe my Mac name?
- AUX and memory
- How do I sleep w/o using any CPU time
- Naming my print job: how?
- alias pathname
-
-
-
- The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
-
- The digest is a collection of article threads from the internet newsgroup
- comp.sys.mac.programmer. It is designed for people who read c.s.m.p. semi-
- regularly and want an archive of the discussions. If you don't know what a
- newsgroup is, you probably don't have access to it. Ask your systems
- administrator(s) for details. (This means you can't post questions to the
- digest.)
-
- Each issue of the digest contains one or more sets of articles (called
- threads), with each set corresponding to a 'discussion' of a particular
- subject. The articles are not edited; all articles included in this digest
- are in their original posted form (as received by our news server at
- cs.uoregon.edu). Article threads are not added to the digest until the last
- article added to the thread is at least one month old (this is to ensure that
- the thread is dead before adding it to the digest). Article threads that
- consist of only one message are generally not included in the digest.
-
- The entire digest is available for anonymous ftp from ftp.cs.uoregon.edu
- [128.223.8.8] in the directory /pub/mac/csmp-digest. Be sure to read the
- file /pub/mac/csmp-digest/README before downloading any files. The most
- recent issues are available from sumex-aim.stanford.edu [36.44.0.6] in the
- directory /info-mac/digest/csmp. If you don't have ftp capability, the sumex
- archive has a mail server; send a message with the text '$MACarch help' (no
- quotes) to LISTSERV@ricevm1.rice.edu for more information.
-
- The digest is also available via email. Just send a note saying that you
- want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
- automatically receive each new issue as it is created. Sorry, back issues
- are not available through the mailing list.
-
- Send administrative mail to mkelly@cs.uoregon.edu.
-
-
- -------------------------------------------------------
-
- From: bitting-douglas@CS.YALE.EDU (Pondscum Czar)
- Subject: Does THINK C have glue for FindFolder?
- Organization: Yale CS Mail/News Gateway
- Date: Sun, 2 Aug 1992 19:57:27 GMT
-
-
- Hi... I am trying not to use SysEnvirons to find the system folder (as,
- really, SysEnvirons has been replaced w/ Sys7). However, I need to make
- sure this App works under System 6 as well... Anyway, I was poking
- through the header files and found this in Folders.h:
-
- - --snip here--
- #if SystemSevenOrLater
- pascal OSErr FindFolder(short vRefNum,OSType folderType,Boolean
- createFolder,
- short *foundVRefNum,long *foundDirID)
- = {0x7000,0xA823};
- #else
- pascal OSErr FindFolder(short vRefNum,OSType folderType,Boolean
- createFolder,
- short *foundVRefNum,long *foundDirID);
- #endif
- - --snip here--
-
- Does the #else clause mean that THINK C provides glue for this function
- like Gestalt? In other words, can I use this under System 6 to find the
- Active System Folder, or do I just stick with SysEnvirons...
-
- Not a big deal, but I guess you could say I am a stickler for details...
- :-)
-
- - --Doug
- - --
- The new Congressmen say they're going to turn the government around. I
- hope I don't get run over again.
-
- +++++++++++++++++++++++++++
-
- From: dodd@apple.com (Mike Dodd)
- Date: Mon, 3 Aug 1992 05:15:22 GMT
- Organization: Apple Computer Inc.
-
- In article <199208030357.AA09618@SUNED.ZOO.CS.YALE.EDU>, bitting-douglas@CS.YALE.EDU (Pondscum Czar) writes:
- >
- >
- > Hi... I am trying not to use SysEnvirons to find the system folder (as,
- > really, SysEnvirons has been replaced w/ Sys7). However, I need to make
- > sure this App works under System 6 as well... Anyway, I was poking
- > through the header files and found this in Folders.h:
- >
- > --snip here--
- > #if SystemSevenOrLater
- > pascal OSErr FindFolder(short vRefNum,OSType folderType,Boolean
- > createFolder,
- > short *foundVRefNum,long *foundDirID)
- > = {0x7000,0xA823};
- > #else
- > pascal OSErr FindFolder(short vRefNum,OSType folderType,Boolean
- > createFolder,
- > short *foundVRefNum,long *foundDirID);
- > #endif
- > --snip here--
- >
- > Does the #else clause mean that THINK C provides glue for this function
- > like Gestalt? In other words, can I use this under System 6 to find the
- > Active System Folder, or do I just stick with SysEnvirons...
- >
-
- yes, you can use it fine. if it doesn't define inline assembly (the
- "= {0x7000..." part), as the second definition doesn't, then that means
- that it includes glue for it (probably in MacTraps or MacTraps2). and, if
- you use something that doesn't have inline assembly or glue, then your
- program will refuse to link, so at least you'll know that way.
-
- - -Mike Dodd-
- Apple Computer
- ** What I say is my opinion. Not Apple's. **
-
-
- ---------------------------
-
- From: djpegg@utkvx4.utk.edu (PEGG, DAVID J)
- Subject: How do I see if modifiers are down?
- Date: 31 Jul 92 18:45:00 GMT
- Organization: University of Tennessee Computing Center
-
- I want to put a feature in my data analysis program that looks to see if Shift
- and Option are down (without any other keys). If they are, then it gets the
- mouse position and tells you where it is in the graph's coordinates. I'm using
- GetKeys to see if the keys are pressed. But I can't seem to get my keyMap to
- show anything for any modifier keys (as well as some keys that really surprise
- me, like 't' and 'y'). Also, no number keys show up, on the number pad or on
- the regular keyboard.
-
- I'm using Think C 5.0.2 with System 7, but programming using mostly stuff from
- IM volumes I & II. I know it has to be possible to do this, since the Key Caps
- DA recognizes modifier keys, even when nothing else is pressed.
-
- Thanks in advance for your help,
- Mike
-
- +++++++++++++++++++++++++++
-
- From: buckeye@spf.trw.com (John Wallace)
- Date: 1 Aug 92 01:27:17 GMT
- Organization: TRW Data Systems Center, Redondo Beach, CA
-
- In article <31JUL199213454178@utkvx4.utk.edu> djpegg@utkvx4.utk.edu (PEGG, DAVID J) writes:
- >I want to put a feature in my data analysis program that looks to see if Shift
- >and Option are down (without any other keys). If they are, then it gets the
- >mouse position and tells you where it is in the graph's coordinates. I'm using
- >GetKeys to see if the keys are pressed. But I can't seem to get my keyMap to
- >show anything for any modifier keys (as well as some keys that really surprise
- >me, like 't' and 'y'). Also, no number keys show up, on the number pad or on
- >the regular keyboard.
- >
- >Thanks in advance for your help,
- > Mike
-
-
- Rather than using the keymap directly, you may want to use
- GetNextEvent/WaitNextEvent to grab the next event and check the
- event's modifier fields for the shift/option/control keys and the
- where field for the mouse location (in global coordinates).
-
- This has several advantages in that you don't have to muck with the
- keyboard resources to verify that the user hasn't re-mapped the key
- since it is possible for me to swap any of the keys on my keyboard.
- Also all of the info you want is available in one simple call.
-
- If you don't want to actually remove any events from the event queue
- then pass in 0 for the event mask.
-
- Cheers!
- John
- - -----
- John Wallace buckeye@spf.trw.com
-
- +++++++++++++++++++++++++++
-
- From: peter@cujo.curtin.edu.au (Peter N Lewis)
- Organization: NCRPDA, Curtin University
- Date: Mon, 3 Aug 1992 01:45:35 GMT
-
- In article <2A79E875.14E5@deneva.sdd.trw.com>, buckeye@spf.trw.com (John
- Wallace) wrote:
-
- > Rather than using the keymap directly, you may want to use
- > GetNextEvent/WaitNextEvent to grab the next event and check the
- > event's modifier fields for the shift/option/control keys and the
- > where field for the mouse location (in global coordinates).
-
- In fact, OSEventAvail is even better, because it doesn't remove any events
- from the queue, and it won't try to switch you out or any foolishness:
-
- dummy := OSEventAvail(0, event);
-
- You can use this to get the mouse position as well, especially if you are a
- background only app and want to avoid calling GetMouse which explodes (why
- get the mouse position in a backgroun only app? To test for idleness of
- course)
-
- Have fun all,
- Peter.
-
- _______________________________________________________________________
- Peter N Lewis, NCRPDA, Curtin University peter@cujo.curtin.edu.au
- GPO Box U1987, Perth WA 6001, AUSTRALIA FAX: +61 9 367 8141
-
- ---------------------------
-
- From: jpurlia@qualcomm.com (John Purlia)
- Subject: Editor for mini icons?
- Date: 30 Jul 92 23:38:26 GMT
- Organization: Qualcomm, Inc.
-
- Does anyone know of any utilities that allows for the creation of color
- icm# resources? I'd like to be able to edit mini icons (12 x 12) in the
- same manner I edit larger icon families in ResEdit.
-
- Thanks!
-
- ...........................................................................
- John Purlia : My brain; not my company's brain. My brain says...
- jpurlia@qualcomm.com : "Just about any movie could be made better
- AppleLink: AM0470 : if one of the characters were a vampire."
- ...........................................................................
-
- +++++++++++++++++++++++++++
-
- From: digi@dgp.toronto.edu (Chris DiGiano)
- Date: 3 Aug 92 20:59:30 GMT
-
- jpurlia@qualcomm.com (John Purlia) writes:
-
- >Does anyone know of any utilities that allows for the creation of color
- >icm# resources? I'd like to be able to edit mini icons (12 x 12) in the
- >same manner I edit larger icon families in ResEdit.
-
- I was looking for the same thing about a month ago. It was suggested
- to me by Tim Dierks at Apple Computer to use the ResEdit 16x16 editor
- and then extract the left 12x12 pixels for the mini icon. I wrote a
- utility program which takes an ICS#, ics4, or ics8 icon and converts
- it to the appropriate icm icon, by dropping off the last four rows of
- pixels and getting rid of the left-most four pixels for each row of
- the color icons. When I drew the mini icons on the screen the results
- were a bit strange:
-
- 1. Eventhough I used a 12x12 destination rectangle, the icm was
- squashed horizontally.
-
- 2. The color icons had a few pixels in the correct place with the
- correct color, but most of it was garbled and had colors which were
- not part of the original ics icons.
-
- I changed my utility program to copy the entire row of 16 colored
- pixels, not just the first 12. This seemed to fix the second
- problem--the colors were right and most pixels were in the right
- place. But now just like their black and white cousins, the icon was
- compressed along the horizontal axis.
-
- When I converted the B&W small icon below
-
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
-
- It got a mini icon which looked like this on the screen:
-
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
-
- That's all the progress I made before giving up and just using small
- icons in my application instead. Let me know if you have any more luck.
-
- - ---
- Chris DiGiano (416) 978-6619, fax: 0458 digi@dgp.utoronto.{ca,bitnet}
- Dynamic Graphics Project, Dept. of Computer Sci. digi@dgp.toronto.edu
- University of Toronto, Canada M5S 1A4 ...!uunet!dgp.toronto.edu!digi
-
- +++++++++++++++++++++++++++
-
- From: jpurlia@qualcomm.com (John Purlia)
- Date: 3 Aug 92 22:19:29 GMT
- Organization: Qualcomm, Inc.
-
- In article <1992Aug3.165930.8006@jarvis.csri.toronto.edu>,
- digi@dgp.toronto.edu (Chris DiGiano) wrote:
- >
- > jpurlia@qualcomm.com (John Purlia) writes:
- >
- > >Does anyone know of any utilities that allows for the creation of color
- > >icm# resources? I'd like to be able to edit mini icons (12 x 12) in the
- > >same manner I edit larger icon families in ResEdit.
- >
- > I was looking for the same thing about a month ago. It was suggested
- > to me by Tim Dierks at Apple Computer to use the ResEdit 16x16 editor
- > and then extract the left 12x12 pixels for the mini icon. I wrote a
- > utility program which takes an ICS#, ics4, or ics8 icon and converts
- > it to the appropriate icm icon, by dropping off the last four rows of
- > pixels and getting rid of the left-most four pixels for each row of
- > the color icons. When I drew the mini icons on the screen the results
- > were a bit strange:
-
- Actually, I came up with a compromise solution and basically handled my
- icons the same way the system does. I created my 12x12 icons using
- ResEdit's 16x16 editor using the middle 12x12 pixels, then plotted the
- small icons with the destination rectangle overlapping my intended region
- by two pixels on each side. Take a look at the SICN resources in the
- system used to plot icons in the Finder. These icons are 16x16 but only
- use the middle 12x12 pixels. I did the same thing, only using an icon
- family and it works MUCH better than plotting a full 16x16 icon within a
- 12x12 destination Rect.
- ...........................................................................
- John Purlia : My brain; not my company's brain. My brain says...
- jpurlia@qualcomm.com : "Just about any movie could be made better
- AppleLink: AM0470 : if one of the characters were a vampire."
- ...........................................................................
-
- ---------------------------
-
- From: zeranguek@gtephx.UUCP (Karl Zerangue)
- Subject: Prolog for Mac
- Organization: gte
- Date: Mon, 27 Jul 1992 21:57:47 GMT
-
- Does anyone know of a Prolog interpreter for the Macintosh?
-
- Thanks in advance!
-
- +++++++++++++++++++++++++++
-
- From: perm@csd.uu.se (Per Mildner)
- Date: 28 Jul 92 17:32:55 GMT
- Organization: Computing Science Dept.,Uppsala University, Sweden
-
-
- We have ported our Prolog interpreter/compiler to the Mac. It was
- available on info-mac but has been removed. It is still available on
- some mirror sites. It is also available by anonymous ftp to
- ftp.csd.uu.se (directory /pub/Tricia/Mac/) where there is one extra
- version for use with 68000 processors (e.g., Classics).
-
-
- It is a WAM based vanilla prolog with no fancy Mac specific stuff
- except ADSP stream support. The ADSP support have been used to
- implement fancy user interfaces for expert systems using SuperCard.
-
- Any questions should go to tricia-request@csd.uu.se (This includes
- requests for the source code).
- Regards,
- - --
- Per Mildner perm@CSD.UU.SE
- Computing Science Dept. tel: +46 18181049
- Uppsala University, Sweden fax: +46 18521270
-
- +++++++++++++++++++++++++++
-
- From: marti@nugget.inf.ethz.ch (Robert Marti)
- Date: 3 Aug 92 16:16:43 GMT
- Organization: Dept. Informatik, Swiss Federal Institute of Technology (ETH), Zurich, CH
-
- In article <wingo-280792084433@zardoz.apple.com>, wingo@apple.com
- (Tony Wingo) writes:
- |>
- |> In article <1992Jul27.215747.4560@gtephx.UUCP>, zeranguek@gtephx.UUCP
- |> (Karl Zerangue) wrote:
- |> >
- |> > Does anyone know of a Prolog interpreter for the Macintosh?
- |>
- |> Check out Open Prolog, available from
- |> grattan.cd.tcd.ie
- |> Last I checked it was in the directory tce/mac.
-
-
- Make that grattan.cs.tcd.ie .
- ^^
-
- Also, Open Prolog is now in the directory languages/open-prolog.
- The curent version is 1.0d35.
-
- - --
- Robert Marti | Phone: +41 1 254 72 60
- Informationssysteme | FAX: +41 1 262 39 73
- ETH-Zentrum | E-Mail: marti@inf.ethz.ch
- CH-8092 Zurich, Switzerland |
-
- ---------------------------
-
- From: ldh@svl.cdc.com (Lawrence D. Hare)
- Subject: ATrap to Determe my Mac name?
- Date: 30 Jul 92 17:57:45 GMT
- Organization: Control Data Systems
-
- Well - I give up. Assuming that the name my Mac has (System 6 & 7) is the
- same
- as in a Unix /etc/hosts file, which it jolly well better be, I need to
- figure out
- what the name of the Mac I am running on is.
-
- I have looked, and looked, and looked.... Surely there is a dead simple
- call!
-
- Anyone know what it is and where it is documented?
- - --
- Lawrence D. Hare Control Data - Silicon Valley Operations
- Consultant Voice: (408) 496 4339 - C/N [234] 4339
- ldh@svl.cdc.com Mail: SVLa60 FAX: (408) 496-4106
-
- +++++++++++++++++++++++++++
-
- From: peirce@outpost.SF-Bay.org (Michael Peirce)
- Date: 31 Jul 92 05:33:05 GMT
- Organization: Peirce Software
-
-
- In article <45905@shamash.cdc.com> (comp.sys.mac.programmer), ldh@svl.cdc.com (Lawrence D. Hare) writes:
- > Well - I give up. Assuming that the name my Mac has (System 6 & 7) is the
- > same
- > as in a Unix /etc/hosts file, which it jolly well better be, I need to
- > figure out
- > what the name of the Mac I am running on is.
- >
- > I have looked, and looked, and looked.... Surely there is a dead simple
- > call!
- >
- > Anyone know what it is and where it is documented?
-
- This comes up ever month or so, but here it is again...
-
- Under System 7 there are two name for a Mac. The User Name (Choose
- name under pre-System 7) is found in the STR resource with ID = -16096
- in the System File. The Machine name is found in the STR resource with
- ID = -16416.
-
- You can fetch either of these by calling GetString() since the System
- File is open in your application.
-
- I don't know how these names relate to the name found in a Unix system
- - - I don't do Unix :-)
-
- - -- Michael Peirce -- peirce@outpost.SF-Bay.org
- - -- Peirce Software -- Suite 301, 719 Hibiscus Place
- - -- -- San Jose, California USA 95117
- - -- Makers of... -- voice: (408) 244-6554 fax: (408) 244-6882
- - -- SMOOTHIE -- AppleLink: peirce & America Online: AFC Peirce
-
- +++++++++++++++++++++++++++
-
- From: mlanett@Apple.COM (Mark Lanett)
- Date: 31 Jul 92 07:07:28 GMT
- Organization: Apple Computer Inc., Cupertino, CA
-
- peirce@outpost.SF-Bay.org (Michael Peirce) writes:
-
-
- >In article <45905@shamash.cdc.com> (comp.sys.mac.programmer), ldh@svl.cdc.com (Lawrence D. Hare) writes:
- >> Well - I give up. Assuming that the name my Mac has (System 6 & 7) is the
- >> same
- >> as in a Unix /etc/hosts file, which it jolly well better be, I need to
- >> figure out
- >> what the name of the Mac I am running on is.
-
- [about the Chooser name]
-
- >I don't know how these names relate to the name found in a Unix system
- >- I don't do Unix :-)
-
- They don't relate. The Chooser name is only used by AppleTalk, not MacTCP.
- For that, you need to make MacTCP calls. Alas, I do sockets, not MacTCP,
- and I doubt I could extract meaningful code out of the socket library I
- use.
- - --
- Have a bajillion brilliant Jobsian lithium licks.
- Mark Lanett, NOT speaking for anyone. Personal opinion only.
-
- +++++++++++++++++++++++++++
-
- From: davidp@calvin.usc.edu (David Peterson)
- Date: 3 Aug 92 17:49:49 GMT
- Organization: University of Southern California, Los Angeles, CA
-
-
- There is no trap as far as I can tell, but if your name resolution
- stuff is working correctly just call AddrToName() with the ip number
- of your Mac (which you can get from GetMyIPAddr()).
-
- Look in the MacTCP docs for details. GetMyIPAddr is on pg 87,
- AddrToName on 75.
-
- - -dave.
-
- ---------------------------
-
- From: jeremyr@dcs.qmw.ac.uk (Jeremy Roussak)
- Subject: AUX and memory
- Date: 3 Aug 92 19:42:28 GMT
- Organization: Computer Science Dept, QMW, University of London
-
- I've written an INIT, called Apollo. To send AEvents, Apollo
- uses a small faceless background app called Eagle. All Eagle
- does it to open a PPC port and wait for messages from Apollo,
- which it converts into AEvents and sends.
-
- Under MacOS, Eagle works perfectly in a 10k partition. Under
- AUX, however, it fails with insufficient memory (-108). If the
- partition is increased to 15k, it works nicely.
-
- Why should this be?
-
- Jeremy
-
- +++++++++++++++++++++++++++
-
- From: keith@taligent.com (Keith Rollin)
- Organization: Taligent
- Date: Tue, 4 Aug 1992 01:59:04 GMT
-
- In article <1992Aug3.194228.6297@dcs.qmw.ac.uk>, jeremyr@dcs.qmw.ac.uk (Jeremy
- Roussak) writes:
- >
- > I've written an INIT, called Apollo. To send AEvents, Apollo
- > uses a small faceless background app called Eagle. All Eagle
- > does it to open a PPC port and wait for messages from Apollo,
- > which it converts into AEvents and sends.
- >
- > Under MacOS, Eagle works perfectly in a 10k partition. Under
- > AUX, however, it fails with insufficient memory (-108). If the
- > partition is increased to 15k, it works nicely.
- >
- > Why should this be?
-
- I think that applications are given a larger stack under A/UX. This is just a
- vague recollection, and, as a card-carrying Mac Bigot, I certainly don't have an
- A/UX system on which to check this out, so you'll have to verify this for
- yourself.
-
- - --
- Keith Rollin
- Phantom Programmer
- Taligent, Inc.
-
-
- ---------------------------
-
- From: crow@spicewood.uucp (David L. Crow)
- Subject: How do I sleep w/o using any CPU time
- Date: 11 Jul 1992 15:17:45 -0500
- Organization: UTexas Mail-to-News Gateway
-
- I am writing an application to check something every so often. If
- something exists, I will then put up an error window. Everything is
- done except that I don't know the best way to sleep until the next
- check and use as little system resources (specifically CPU) as
- possible. In UNIX, I would just sleep and the process would be
- put to sleep.
-
- I looked in the UNIX compatibility source in THINK C, and they
- implemented a sleep as "Delay". When I tried Delay, I couldn't
- get control back from the app during the delay.
-
- I looked in the UUPC source, and they did it by getting the tick
- count and then going through a while loop until so many ticks had
- gone by. While this works, it seems like it would not be very
- efficient (read MultiFinder friendly) even though I don't have
- any problems with UUPC and the MultiFinder.
-
- Basically, I guess that I just want to know the best way to put
- my application to sleep for a given amount of time.
-
- Thanks for any help you can provide!
-
- David L. Crow UUCP: cs.utexas.edu!rpp386!spicewood!crow
- Internet: crow%spicewood@rpp386.lonestar.org
-
- - ---
-
- +++++++++++++++++++++++++++
-
- From: cory@enigami.mv.com (Cory Kempf)
- Date: 12 Jul 92 05:55:50 GMT
- Organization: EnigamI, Inc., Nashua, NH
-
-
- In article <a684a397@spicewood.uucp> (comp.sys.mac.programmer), crow@spicewood.uucp (David L. Crow) writes:
- > I am writing an application to check something every so often. If
- > something exists, I will then put up an error window. Everything is
- > done except that I don't know the best way to sleep until the next
- > check and use as little system resources (specifically CPU) as
- > possible. In UNIX, I would just sleep and the process would be
- > put to sleep.
-
- MacOS Pet Peive #375: Delay doesn't give up the CPU.
-
- The way to give up the CPU is to call WaitNextEvent, passing it a
- large number of the 3rd parameter (time that WNE can give away).
- I usually use 50 or so (there was this bug a while back...). By putting
- this inside a while loop that checks the tickcount, I give away as
- much CPU as I can.
-
- When an application is in the background, it doesn't get as much CPU
- to start with. With a loop as described, its impact should be minimal.
-
- +C
-
-
- - -------------------------------------------------------------
- Cory Kempf EnigamI, Inc.
- cory@enigami.mv.com ...!decvax!enigami!cory
- Annon: wi.5036@wizvax.methuen.ma.us
-
- "F' cryin' out loud, it's *your* life; shouldn't you at least examine
- your lifestyle values to see if they are really what *you* want."
- --Keith Lim
-
- +++++++++++++++++++++++++++
-
- From: Andreas Wuertz <wuertz@systech.tik.ethz.ch>
- Organization: Swiss Federal Institute of Technology, TIK
- Date: Tue, 14 Jul 1992 11:49:05 GMT
-
- In article <a684a397@spicewood.uucp> David L. Crow, crow@spicewood.uucp
- writes:
- > Basically, I guess that I just want to know the best way to put
- > my application to sleep for a given amount of time.
-
- Use WaitNextEvent(myEventMask, &theEvent, maxidle, mouseRgn); see inside
- mac for exact definition of the parameters for this function. maxidle is
- the amount of ticks you want to sleep if no event is there for you; so
- you are woken up after maxidle ticks THE LATEST. If you want to make
- something periodically, you'd need to write something like:
- if WaitNextEvent(myEventMask, &theEvent, maxidle, mouseRgn) {
- if (theEvent.when-lastWakeup>=desiredIdle) {
- HandlePeriodicAction();
- maxIdle=desiredIdle;
- } else
- maxIdle=desiredIdle-(TickCount()-lastWakeup);
- lastWakeup=TickCount();
- };
-
- Not exactly, but I hope you get the idea. Hope this helps.
-
- Andy
-
- Andy from TIK
-
- =======================================================
- The earliest time for a program to be bug-free is,
- when it's out of date. The latest time for a programmer
- to retire is, when he writes such a program.
- =======================================================
-
- +++++++++++++++++++++++++++
-
- From: resnick@cogsci.uiuc.edu (Pete Resnick)
- Organization: University of Illinois at Urbana
- Date: Tue, 14 Jul 1992 13:54:23 GMT
-
- davidp@calvin.usc.edu (David Peterson) writes:
-
- >How about during completion procs -- can't call WNE then.
-
- >What I've been doing is parking in a SystemTask/TickCount loop. Will this
- >allow things to go on in the background? Will it allow other completion
- >procs to execute? (Skip reentrancy problems, I _think_ that's taken care
- >of)
-
- Eeeee! This is a design problem, Dave.
-
- If you are getting called at interrupt and it is not time to do what
- you have to do, you should do something that will cause another
- interrupt later when it is time and return immediately. If I had to
- wait for a certain time to roll around when my completion proc gets
- called I would do the following:
-
- My completion proc does only one thing: install a Time Manager task
- that is set to go off at the appropriate time. My completion routine
- would simply figure out how much time I need to wait and install the
- TM task.
-
- The completion routine for the TM task would do all of the work I need
- to do. If I determined in my original completion proc that I didn't
- need to wait at all, I could always call the TM task completion
- routine directly from there.
-
- Things that execute at interrupt are doing so because "they must
- execute now and fast", as far as the OS is concerned. Do as little as
- possible during interrupt and don't hang on to the processor.
-
- pr
- - --
- Pete Resnick (...so what is a mojo, and why would one be rising?)
- Graduate assistant - Philosophy Department, Gregory Hall, UIUC
- System manager - Cognitive Science Group, Beckman Institute, UIUC
- Internet: resnick@cogsci.uiuc.edu
-
- +++++++++++++++++++++++++++
-
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Date: 15 Jul 92 18:07:17 +1200
- Organization: University of Waikato, Hamilton, New Zealand
-
- In article <1992Jul13.150027.4926@usenet.ins.cwru.edu>, Jerome Chan <yjc@po.cwru.edu> writes:
- > In article <0105011F.8acslo@dragon.enigami.mv.com> Cory Kempf,
- > cory@enigami.mv.com writes:
- >>The way to give up the CPU is to call WaitNextEvent, passing it a
- >>large number of the 3rd parameter (time that WNE can give away).
- >>I usually use 50 or so (there was this bug a while back...). By putting
- >>this inside a while loop that checks the tickcount, I give away as
- >>much CPU as I can.
-
- The bug was in MultiFinder 1.0, System 4.2. i e it's long gone.
-
- > Hmm. But won't we be losing events if we do this? If windows are being
- > displayed and the user switches to another application under
- > multi-finder, won't we lose the the Update Event? Or is that the
- > Resume/Suspend Event?
-
- It's the Resume/Suspend event, and I'm pretty sure you're right--I recall
- reading this in the MultiFinder documentation a while back, though I'm having
- difficulty finding the same info in IM6 chapter 5. Basically if you mask out
- app4/OS events, you won't see the suspend/resume events--they simply disappear.
-
- You could of course put in calls to your regular suspend/resume event handling
- code in the delay loop. Another technique involves having only a single event
- loop in your program, and being able to selectively enable/disable handling
- of particular event types (e g mouse and key clicks) when your program is in a
- "busy" state. And being able to specify a "background" task to perform
- each time round the event loop.
-
- Lawrence D'Oliveiro fone: +64-7-856-2889
- Computer Services Dept fax: +64-7-838-4066
- University of Waikato electric mail: ldo@waikato.ac.nz
- Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
- The aliens are willing to spare the Earth, on condition we surrender to them
- the country responsible for Kylie Minogue.
-
- +++++++++++++++++++++++++++
-
- From: Bruce.Hoult@bbs.actrix.gen.nz
- Organization: Actrix Information Exchange
- Date: Wed, 15 Jul 1992 12:33:58 GMT
-
- In article <1992Jul15.180717.9387@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
- > The aliens are willing to spare the Earth, on condition we surrender to them
- > the country responsible for Kylie Minogue.
-
- ... not to mention "shrimp on the barbie" and the term of endearment "bogan".
- - --
- Bruce.Hoult@bbs.actrix.gen.nz Twisted pair: +64 4 477 2116
- BIX: brucehoult Last Resort: PO Box 4145 Wellington, NZ
- "Cray's producing a 200 MIPS personal computer with 64MB RAM and a 1 GB
- hard disk that fits in your pocket!" "Great! Is it PC compatable?"
-
- +++++++++++++++++++++++++++
-
- From: thomasc@dragonfly.wri.com (Thomas Chin)
- Organization: Wolfram Research, Inc.
- Date: Tue, 14 Jul 1992 16:15:50 GMT
-
- >In article <a684a397@spicewood.uucp> David L. Crow, crow@spicewood.uucp
- >writes:
- >> Basically, I guess that I just want to know the best way to put
- >> my application to sleep for a given amount of time.
-
- With system 7 process manager, you can have a time manager task which do
- a 'WakeUpProcess', install the timer, go into your yielding 'WaitNextEvent'
- with maximum sleep ticks and empty mask, you'll get a NULL event when the
- time is up!
-
- - -Tom
-
- +++++++++++++++++++++++++++
-
- From: joshr@kronos.arc.nasa.gov (Joshua Rabinowitz-Summer-91)
- Date: 24 Jul 92 00:09:28 GMT
- Organization: NASA/ARC Information Sciences Division
-
- In article <28474@goofy.Apple.COM> dwb@apple.com (David W. Berry) writes:
- >In article <a684a397@spicewood.uucp>, you write:
- >> I am writing an application to check something every so often. If
- >> something exists, I will then put up an error window. Everything is
- >Typed in off the type of my head, so this isn't error checked (or really
- >even syntax checked) but it will give you the general idea...
- >
- >pascal void Delay(long ticks)
- >{
- > long wakeTime = TickCount() + ticks;
- > long delay;
- > EventRecord event;
- >
- > while((delay = (wakeTime - TickCount()) > 0)
- > WaitNextEvent(0, &event, delay, 0);
- >}
-
- The only problem with this, as I remember it
- (and please correct me if I'm wrong),
- that apple events cannot be masked. I looked in inside mac for this, but
- could not find a reference to this ?fact?. (looked at The Event Manager,
- IM VI, p. 5-29) I cannot recall where I got this idea from.
-
- Can anyone refute or back up this belief?
- - --
- - ----------------------------------
- #include <std/disclaimer.h> Josh Rabinowitz, Mac TCL programmer
- joshr@kronos.arc.nasa.gov
- "'I see', said the blind carpenter, as he picked up his hammer and saw".
-
- +++++++++++++++++++++++++++
-
- From: dwb@apple.com (David W. Berry)
- Date: 17 Jul 92 21:19:45 GMT
- Organization: Greenwing Enterprises
-
- In article <a684a397@spicewood.uucp>, you write:
- > I am writing an application to check something every so often. If
- > something exists, I will then put up an error window. Everything is
- Typed in off the type of my head, so this isn't error checked (or really
- even syntax checked) but it will give you the general idea...
-
- pascal void Delay(long ticks)
- {
- long wakeTime = TickCount() + ticks;
- long delay;
- EventRecord event;
-
- while((delay = (wakeTime - TickCount()) > 0)
- WaitNextEvent(0, &event, delay, 0);
- }
-
- +++++++++++++++++++++++++++
-
- From: dowdy@apple.com (Tom Dowdy)
- Date: 20 Jul 92 15:15:13 GMT
- Organization: Apple Computer, Inc.
-
- In article <1992Jul13.150027.4926@usenet.ins.cwru.edu>, yjc@po.cwru.edu
- (Jerome Chan) wrote:
- >
- > In article <0105011F.8acslo@dragon.enigami.mv.com> Cory Kempf,
- > cory@enigami.mv.com writes:
- > >The way to give up the CPU is to call WaitNextEvent, passing it a
- > >large number of the 3rd parameter (time that WNE can give away).
- > >I usually use 50 or so (there was this bug a while back...). By putting
- > >this inside a while loop that checks the tickcount, I give away as
- > >much CPU as I can.
- >
- > Hmm. But won't we be losing events if we do this? If windows are being
- > displayed and the user switches to another application under
- > multi-finder, won't we lose the the Update Event? Or is that the
- > Resume/Suspend Event?
-
- Actually, you won't be losing events - however, there is a potential
- serious
- problem with calling WNE this way all of the time. Note that in *this*
- particular case, the original poster (long since gone from this discussion,
- I would fear) wasn't going to have any windows open - he was simply running
- until an event happened, at which time a dialog box would be brought
- up (no doubt saying something such as "Your rendering is complete").
-
- However, if you *do* have windows open, and fail to respond to update
- events, you will see very sluggish performance on your Mac as the
- process manager attempts to give you updateEvents over and over again.
- Eventually, when it sees some very large number of update events go
- by for the same window, it will assume you are clueless and clear
- the updateRgn itself - however, this takes almost a minute and a half.
-
- The thing to learn is - always handle update events, and always call
- BeginUpdate()/EndUpdate() when handling them.
-
- Tom Dowdy Internet: dowdy@apple.COM
- Apple Computer MS:81KS UUCP: {sun,voder,amdahl,decwrl}!apple!dowdy
- 20525 Mariani Ave AppleLink: DOWDY1
- Cupertino, CA 95014
- "The 'Ooh-Ah' Bird is so called because it lays square eggs."
-
- +++++++++++++++++++++++++++
-
- From: cory@enigami.mv.com (Cory Kempf)
- Date: Fri, 24 Jul 92 11:52:07 EST
- Organization: EnigamI, Inc., Nashua, NH
-
-
- In article <dowdy-200792081218@90.10.20.25> (comp.sys.mac.programmer), dowdy@apple.com (Tom Dowdy) writes:
- >In article <1992Jul13.150027.4926@usenet.ins.cwru.edu>, yjc@po.cwru.edu
- >(Jerome Chan) wrote:
- >>
- >> In article <0105011F.8acslo@dragon.enigami.mv.com> Cory Kempf,
- >> cory@enigami.mv.com writes:
- >> >The way to give up the CPU is to call WaitNextEvent, passing it a
- >> >large number of the 3rd parameter (time that WNE can give away).
- >> >I usually use 50 or so (there was this bug a while back...). By putting
- >> >this inside a while loop that checks the tickcount, I give away as
- >> >much CPU as I can.
- >>
- >> Hmm. But won't we be losing events if we do this? If windows are being
- >> displayed and the user switches to another application under
- >> multi-finder, won't we lose the the Update Event? Or is that the
- >> Resume/Suspend Event?
- >
- >Actually, you won't be losing events - however, there is a potential
- >serious
- >problem with calling WNE this way all of the time. Note that in *this*
- >particular case, the original poster (long since gone from this discussion,
- >I would fear) wasn't going to have any windows open - he was simply running
- >until an event happened, at which time a dialog box would be brought
- >up.
-
- No, I'm still here, just a bit behind.
-
- And yes, when I do actually do a delay like that, I am usually initializing
- my application, which (in many cases) requires that I wait for some
- hardware to respond. The only window open at this point is the splash
- screen. Normally though there is the possibility that the user would wish
- to interact with them or make a selection from a menu (like Quit!), so I
- would call my Yield(long time) routine instead. Yield() repeatedly calls
- my main event function (the looping is done externaly) until 'time' had
- passed. This has the added benefit of making sure the mouse was correct.
-
- Some other magic was in place to prevent re-entrancy.
-
- Usually though, if I am doing something that is long and involved,
- I would put up a dialog box with a thermometer in it (movable modal,
- of course!) to let the user know how much longer until I was finished.
-
- >However, if you *do* have windows open, and fail to respond to update
- >events, you will see very sluggish performance on your Mac as the
- >process manager attempts to give you updateEvents over and over again.
- >Eventually, when it sees some very large number of update events go
- >by for the same window, it will assume you are clueless and clear
- >the updateRgn itself - however, this takes almost a minute and a half.
-
- Would this still happen if the first parameter to WNE was 0, indicating
- that I didn't want ANY events?
-
- +C
-
-
- - -------------------------------------------------------------
- Cory Kempf EnigamI, Inc.
- cory@enigami.mv.com ...!decvax!enigami!cory
- Annon: wi.5036@wizvax.methuen.ma.us
-
- "F' cryin' out loud, it's *your* life; shouldn't you at least examine
- your lifestyle values to see if they are really what *you* want."
- --Keith Lim
-
- +++++++++++++++++++++++++++
-
- From: jtn@ADS.COM (John T. Nelson)
- Date: 4 Aug 92 03:29:43 GMT
- Organization: Advanced Decision Systems, Mtn. View, CA (415) 960-7300
-
- Why not use the time manager to schedule tasks? Delay loops are crude.
-
- - - Hacker
-
- ---------------------------
-
- From: paul@fairgate.uucp (Paul Robichaux)
- Subject: Naming my print job: how?
- Date: 4 Aug 92 05:26:31 GMT
- Organization: Fairgate Technologies
-
- After a bit of hacking to make my plotting and printing code work
- properly (thanks to Apple for their source code snippets, especially
- HairLines), I'd like to dress up my printing routines a bit.
-
- Right now, my app has one main window (titled "Control"), and whenever
- I print a document from it, the print job has that same title. I know
- it's possible to tag the job with an arbitrary title ("foo @ HellWriter"
- has sort of a nice ring to it) and would like to add this feature to
- my application, so that I can identify the specific kind of plot or
- graph being printed instead of just "Control."
-
- I'll post a summary of responses.
-
- - -Paul
-
- - ---
- Paul Robichaux, KD4JZG
- paul@fairgate.uucp -or- ...uunet!{sci34hub,xavax}!fairgate!paul
-
- +++++++++++++++++++++++++++
-
- From: zben@ni.umd.edu (Charles B. Cranston)
- Organization: UM Home for the Terminally Analytical
- Date: Tue, 4 Aug 1992 21:13:46 GMT
-
- In article <a6a37127@fairgate.uucp>, paul@fairgate.uucp (Paul Robichaux)
- wrote:
-
- > Right now, my app has one main window (titled "Control"), and whenever
- > I print a document from it, the print job has that same title. I know
- > it's possible to tag the job with an arbitrary title ("foo @ HellWriter"
- > has sort of a nice ring to it) and would like to add this feature to
- > my application, so that I can identify the specific kind of plot or
- > graph being printed instead of just "Control."
-
- As I understand it the printing complex takes the frontmost window's
- title as the job name. I suppose you could always temporarily change
- the window's title for just the duration of the printing.
-
- zben@ni.umd.edu -KA3ZDF
-
- ---------------------------
-
- From: kofoid@bioscience.utah.edu (Eric C. Kofoid)
- Subject: alias pathname
- Date: 3 Aug 92 22:18:32 GMT
- Organization: Dept. Biology, University of Utah
-
- I want a getFile dialog to return the pathname to an alias itself, *not*
- the target of an alias. Since StandardGetFile always resolves the alias,
- I decided to use a call to CustomGetFile. My dialog hook function traps
- the pseudo-items "sfHookOpenAlias" and "sfHookGoToaliasTarget", but I
- discover that I haven't the slightest idea what to do at this point.
- Simply returning a null event at this point selects nothing in the dialog
- list. Any ideas?
-
- I want my users to be able to create a default list of of input files
- which
- will be maintained during future activations of the program. Say that one
- of the files lives on a file server. When users wish to add this to the
- list, they use a getFile dialog. This in turn resolves the alias and adds
- its target to the list of files. This is fine, as long as there is a
- connection to the file server. However, if naive users activate the
- program
- when the connection is not there, then they will be informed that the
- volume is not mounted or that the file does not exist. If the alias
- itself
- were named in the list, a login dialog would appear allowing the user to
- create the connection immediately (no connection), or the alias target
- would be opened in the normal fashion (connection already there).
-
- __________________________________________________________________
- | Eric Kofoid Dept.Biology, U. of Utah |
- | "Being certain of the conclusion assists in finding the proof" |
- | Galileo, 17th century |
- |__________________________________________________________________|
-
- +++++++++++++++++++++++++++
-
- From: ross@bnr.ca (Ross Brown)
- Date: 4 Aug 92 14:13:44 GMT
- Organization: Bell-Northern Research
-
- In article <1992Aug3.221832.4563@fcom.cc.utah.edu> Eric C. Kofoid
- <kofoid@bioscience.utah.edu> writes:
- >I want a getFile dialog to return the pathname to an alias itself, *not*
- >the target of an alias. Since StandardGetFile always resolves the alias,
- >I decided to use a call to CustomGetFile. My dialog hook function traps
- >the pseudo-items "sfHookOpenAlias" and "sfHookGoToaliasTarget", but I
- >discover that I haven't the slightest idea what to do at this point.
- >Simply returning a null event at this point selects nothing in the dialog
- >list. Any ideas?
-
- You need to "map" sfHookOpenAlias to sfItemOpenButton.
- This works for me in MPW C:
-
- pascal short DefeatAliasDialogHook( short item, DialogPtr theDialog,
- Ptr myDataPtr )
- {
- #pragma unused( theDialog, myDataPtr )
- if( item == sfHookOpenAlias )
- return sfItemOpenButton;
- else
- return item;
- }
-
- ...
- CustomGetFile( (FileFilterYDProcPtr) AliasOnlyFileFilter, -1, nil, &reply,
- 0, centerScreen, DefeatAliasDialogHook, nil, nil, nil, nil );
- ...
-
- Your file filter (first argument) would probably be "nil".
-
- W. Ross Brown | from Brown's Bestiary of the Macintosh:
- Advisor, Telemanagement Svcs. | PBCatMoof: A purring system trap shaped like
- Bell-Northern Research Ltd. | a dog with cow spots and a 3-hr. battery life.
- Ottawa, Ontario, Canada | ----------------------------------------------
- ross@bnr.ca | Any opinion expressed is mine, not BNR's.
-
- ---------------------------
-
- End of C.S.M.P. Digest
- **********************
-